import lstore from '@/plugins/lstore/'

export default {
  // 保存当前登录用户信息
  SAVE_CURRENTUSER(state, info) {
    state.CURRENTUSER = info
    lstore.setData('CURRENTUSER', state.CURRENTUSER)
    lstore.setData('H5_CUR_USER', state.CURRENTUSER)
  },
  // 注销登录
  SIGN_OUT(state) {
    try {
      state.CONFIG = {}
      state.CURRENTUSER = {}
      lstore.removeData('CURRENTUSER')
      lstore.removeData('H5_CUR_USER')
      lstore.removeData('BOOTSTRAPPERS')
      lstore.removeData('H5_ACCESS_TOKEN')
      state.loginStatus = false
    } catch (e) {
      // no condition here
    }
  },
  SAVE_CONFIG(state, config) {
    state.CONFIG = config
    lstore.setData('BOOTSTRAPPERS', config)
  }
}
